﻿@inherits TscComponentBase
@namespace Masa.Tsc.Web.Admin.Rcl.Components

<SSheetDialog Value=Visible OnClosed=DialogVisibleChanged Title="@Team?.CurrentProject?.Name" EnableDomReload>
    @if (Team is not null)
    {
        <MCard Style="background-color:#F0F3FA;border-top-left-radius: 20px;border-top-right-radius: 20px;" Class="full-height">
            <MRow NoGutters Class="full-height">
                <MCol Style="background-color:white;border-top-left-radius: 20px;" Cols="2" Class="d-flex flex-column justify-space-between pa-6">
                    <ProjectDetail Value=@Team.CurrentProject></ProjectDetail>
                    <TeamDetail Value=@Team></TeamDetail>
                </MCol>
                <MCol Cols="10" Class="pa-6 full-height overflow-hidden">
                    <MRow Class="@Class">
                        <MCol Cols="6" Class="d-flex justify-start align-center">
                            <div style="width:210px;">
                                <ServiceAutoComplete Services="Apps" Value="@ConfigurationRecord.Service" ValueChanged="OnServiceChanged" @ref="ServiceAutoComplete" FillBackground=false Metric=false />
                            </div>
                            <MChip Class="mx-6" Color="#05CD99" TextColor="white">@ServiceAutoComplete?.CurrentApp()?.Type</MChip>
                            <div style="width:160px;">
                                <EllipsisText>
                                    @I18n.Team("APPID"):@ServiceAutoComplete!.CurrentApp()?.Identity
                                </EllipsisText>
                            </div>
                        </MCol>
                        <MCol Cols="6" Class="d-flex justify-end align-center">
                            <SDateTimeRangeToolbar                               
                                @bind-StartDateTime="StartTime"
                                @bind-EndDateTime="EndTime"
                                @bind-DefaultQuickRange="DefaultQuickRangeKey"
                                @bind-Interval="@ConfigurationRecord.Interval"
                                @bind-UseAbsoluteTime="@ConfigurationRecord.UseAbsoluteTime"
                                ShowInterval
                                ShowQuickChange
                                ShowTimeZoneSelector
                                OnUpdate="OnDateTimeUpdateAsync"
                                OnAutoUpdate="OnAutoDateTimeUpdateAsync" />
                            <SButton OnClick=NavigateToDashboardConfiguration Class="ml-6" Small BorderRadiusClass="rounded-lg">
                                @I18n.T("Show Detail")
                            </SButton>
                        </MCol>
                        @if (ErrorCount > 0)
                        {
                            <MCol Class="py-0 mb-3">
                                <div class="rounded-lg d-flex justify-space-between py-1 px-4 align-center" style="background-color:#FF5252;height: 56px;">
                                    <div class="d-flex align-center white--text"><SIcon Class="pr-3" Color="white text-#FF5252">info</SIcon> @string.Format(I18n.Team("Currently the application has {0} error records"),ErrorCount.ToString())</div>
                                    <SButton Depressed Color="white--text" Style="background-color:#FF5252;text-decoration:underline" OnClick="OpenTraceAsync">@I18n.T("Show Detail")</SButton>
                                </div>
                            </MCol>
                        }
                    </MRow>
                    <MRow Class="overflow-y mx-0" Style="@(ErrorCount > 0?"max-height: calc(100% - 112px);":"height: 100%;")">
                        <ProjectCharts Class="mt-0" ConfigurationRecord="childConfiguration" />
                    </MRow>
                </MCol>
            </MRow>
        </MCard>
    }
</SSheetDialog>
